<template>
  <div class="app-container home">
   <!-- <h3>工会数据统计</h3>-->
    <el-row :gutter="24" >
      <el-col :span="6"><h3 style="font-weight: bold">工会数据统计</h3></el-col>
      <el-col :span="4" :offset="12">
        <el-date-picker
          v-model="dateRange"
          size="small"
          style="width: 240px; margin-right: 10px"
          value-format="yyyy-MM-dd"
          type="daterange"
          @change="onPick"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"></el-date-picker>
      </el-col>
      <!--<el-col :span="4" >
        <el-date-picker
          v-model="dateRange"
          size="small"
          style="width: 240px; margin-right: 10px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"></el-date-picker>
      </el-col>-->
    </el-row>
    <!--<el-divider />-->

    <el-row :gutter="20">
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>工会数</span>
          </div>
          <div class="body text-center" >
             <!-- <i class="el-icon-s-promotion"></i>-->
              <el-link href="http://www.ruoyi.vip" target="_blank"/>
                <p style="font-size: large">{{deptNum}}</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>会员数</span>
          </div>
          <div class="body text-center" >
           <!-- <i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">{{sysMiniUserNum}}</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>申请入会人数</span>
          </div>
          <div class="body text-center" >
           <!-- <i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">{{appMembershipNum}}</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>申请转会人数(转入/转出)</span>
          </div>
          <div class="body text-center" >
            <!--<i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">{{intoNum}}/{{outNum}}</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>申请退会人数</span>
          </div>
          <div class="body text-center" >
           <!-- <i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">{{appWithdrawalNum}}</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>会费缴纳总额</span>
          </div>
          <div class="body text-center" >
           <!-- <i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">0</p>
          </div>
        </el-card>
      </el-col>
    </el-row>

      <!--<h3 style="padding-top: 200px;">补助申报数据统计
      </h3>
      <el-date-picker
                      v-model="dateRange"
                      size="small"
                      style="width: 240px; margin-right: 10px"
                      value-format="yyyy-MM-dd"
                      type="daterange"
                      range-separator="-"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"></el-date-picker>-->
    <el-row :gutter="24" style="padding-top: 80px;">
      <el-col :span="6"><h3 style="font-weight: bold">补助申报数据统计</h3></el-col>
      <el-col :span="4" :offset="12">
        <el-date-picker
          v-model="dateRange1"
          size="small"
          style="width: 240px; margin-right: 10px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          @change="onPick1"
          start-placeholder="开始日期"
          end-placeholder="结束日期"></el-date-picker>
      </el-col>
      <!--<el-col :span="4" >
        <el-date-picker
          v-model="dateRange"
          size="small"
          style="width: 240px; margin-right: 10px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"></el-date-picker>
      </el-col>-->
    </el-row>
     <!-- <el-divider />-->

    <el-row :gutter="20">
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>补助申报人数</span>
          </div>
          <div class="body text-center" >
            <!--<i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">{{appSubsidyNum}}</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>申报通过人数</span>
          </div>
          <div class="body text-center" >
           <!-- <i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">{{appSubsidyPassNum}}</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>申报总金额（元）</span>
          </div>
          <div class="body text-center" >
            <!--<i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">0</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :md="6" :lg="4">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>已发放总金额（元）</span>
          </div>
          <div class="body text-center" >
           <!-- <i class="el-icon-s-promotion"></i>-->
            <el-link href="http://www.ruoyi.vip" target="_blank"/>
            <p style="font-size: large">0</p>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
  import { getDeptNum,getSysMiniUserNum,getAppMembershipNum,listOutNum,listIntoNum,getAppWithdrawalNum,getAppSubsidyNum,getAppSubsidyPassNum,getDateNowBewteen } from "@/api/index/index";

export default {
  name: "Index",
  data() {
    return {
      // 版本号
      version: "3.8.1",
      // 日期范围
      dateRange: [],
      // 日期范围
      dateRange1: [],
      queryParams: {
        beginTime:null,
        endTime:null,
      },
      deptNum:'0',
      sysMiniUserNum:'0',
      appMembershipNum:'0',
      outNum:'0',
      intoNum:'0',
      appWithdrawalNum:'0',
      appSubsidyNum:'0',
      appSubsidyPassNum:'0',
    };
  },
  created() {
    this.getDeptNum();
    this.getSysMiniUserNum();
    this.getAppMembershipNum();
    this.listOutNum();
    this.listIntoNum();
    this.getAppWithdrawalNum();
    this.getAppSubsidyNum();
    this.getAppSubsidyPassNum();
    //this.getDateNowBewteen();
  },
  methods: {
    onPick(){
      console.log("111");
      this.getAppMembershipNum();
      this.listOutNum();
      this.listIntoNum();
      this.getAppWithdrawalNum();
    },
    onPick1(){
      console.log("222");
      this.getAppSubsidyNum();
     this.getAppSubsidyPassNum();
    },
    getDeptNum(){
      /*this.queryParams.beginTime =  this.dateRange[0];
      this.queryParams.endTime =  this.dateRange[1];*/
      getDeptNum().then(response => {
        this.deptNum = response.data;
      });
    },
    getSysMiniUserNum(){
      getSysMiniUserNum().then(response => {
        this.sysMiniUserNum = response.data;
      });
    },
    getAppMembershipNum(){
      this.queryParams.beginTime =  this.dateRange[0];
      this.queryParams.endTime =  this.dateRange[1];
      getAppMembershipNum(this.queryParams).then(response => {
        this.appMembershipNum = response.data;
      });
    },
    listOutNum(){
      this.queryParams.beginTime =  this.dateRange[0];
      this.queryParams.endTime =  this.dateRange[1];
      listOutNum(this.queryParams).then(response => {
        this.outNum = response.data;
      });
    },
    listIntoNum(){
      this.queryParams.beginTime =  this.dateRange[0];
      this.queryParams.endTime =  this.dateRange[1];
      listIntoNum(this.queryParams).then(response => {
        this.intoNum = response.data;
      });
    },
    getAppWithdrawalNum(){
      this.queryParams.beginTime =  this.dateRange[0];
      this.queryParams.endTime =  this.dateRange[1];
      getAppWithdrawalNum(this.queryParams).then(response => {
        this.appWithdrawalNum = response.data;
      });
    },
    //申报数据统计
    getAppSubsidyNum(){
      this.queryParams.beginTime =  this.dateRange1[0];
      this.queryParams.endTime =  this.dateRange1[1];
      getAppSubsidyNum(this.queryParams).then(response => {
        this.appSubsidyNum = response.data;
      });
    },
    getAppSubsidyPassNum(){
      this.queryParams.beginTime =  this.dateRange1[0];
      this.queryParams.endTime =  this.dateRange1[1];
      getAppSubsidyPassNum(this.queryParams).then(response => {
        this.appSubsidyPassNum = response.data;
      });
    },
    getDateNowBewteen(){
      getDateNowBewteen().then(response => {
        console.log(response.data);
        this.dateRange1[0]=response.data.startTime;
        this.dateRange1[1]=response.data.endTime;
        console.log(this.dateRange1[0]);
      });
    },
    goTarget(href) {
      window.open(href, "_blank");
    },
  },
};
</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>

